package sigeco.model;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

import org.hibernate.validator.NotNull;

/**
 * Matrix Class.
 * 
 * Represents a Competency Matrix.
 * 
 * A Competency Matrix defines a number of Knowledge Areas and related
 * Abilities.
 *  
 * A Competency Matrix has Unique name for identification.
 * 
 * A Competency Matrix defines its Cells that are pairs of Knowledge and Ability.
 * 
 * @author julien
 */
@Entity
@Table(name = "matrices", uniqueConstraints = @UniqueConstraint(columnNames = "name"))
public class Matrix {
	
	private long id;
	private String name;
	private Set<Ability> abilities = new HashSet<Ability>();
	private Set<KnowledgeGroup> knowledgeGroups = new HashSet<KnowledgeGroup>();
	private Set<Cell> cells = new HashSet<Cell>();

	@NotNull
	public String getName() {
		return this.name;
	}

	public void setName(final String nome) {
		this.name = nome;
	}

	@OneToMany(targetEntity = Ability.class, mappedBy = "matrix")
	@NotNull
	public Set<Ability> getAbilities() {
		return this.abilities;
	}

	public void setAbilities(final Set<Ability> habilidades) {
		this.abilities = habilidades;
	}

	@OneToMany(targetEntity = KnowledgeGroup.class, mappedBy = "matrix")
	@NotNull
	public Set<KnowledgeGroup> getKnowledgeGroups() {
		return this.knowledgeGroups;
	}

	public void setKnowledgeGroups(final Set<KnowledgeGroup> grupos) {
		this.knowledgeGroups = grupos;
	}

	@OneToMany(targetEntity = Cell.class, mappedBy = "matrix")
	@NotNull
	public Set<Cell> getCells() {
		return this.cells;
	}

	public void setCells(final Set<Cell> celulas) {
		this.cells = celulas;
	}

	@Id
	@GeneratedValue
	public long getId() {
		return this.id;
	}

	public void setId(final long id) {
		this.id = id;
	}
	
	
}
